<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<!DOCTYPE html>
<html>
<head>
    <!-- 页面meta -->
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <title>科情服务任务列表</title>
    <meta name="description" content="科情服务列表">
    <meta name="keywords" content="科情服务">
    <meta content="width=device-width,initial-scale=1,maximum-scale=1,user-scalable=no" name="viewport">
    <link rel="stylesheet" href="${pageContext.request.contextPath}/plugins/bootstrap/css/bootstrap.min.css">
    <link rel="stylesheet" href="${pageContext.request.contextPath}/plugins/bootstrap/css/bootstrapValidator.css">
    <link rel="stylesheet" href="${pageContext.request.contextPath}/plugins/font-awesome/css/font-awesome.min.css">
    <link rel="stylesheet" href="${pageContext.request.contextPath}/plugins/adminLTE/css/AdminLTE.css">
    <link rel="stylesheet" href="${pageContext.request.contextPath}/plugins/adminLTE/css/skins/_all-skins.min.css">
    <link rel="stylesheet" href="${pageContext.request.contextPath}/css/style.css">
    <script src="${pageContext.request.contextPath}/plugins/jQuery/jquery-3.4.1.js"></script>
    <script src="${pageContext.request.contextPath}/plugins/bootstrap/js/bootstrap.min.js"></script>
    <script src="${pageContext.request.contextPath}/plugins/bootstrap/js/bootstrapValidator.min.js"></script>
    <script src="${pageContext.request.contextPath}/plugins/template/template-web.js"></script>
</head>

<body style="overflow-y: auto">
<!-- .box-body -->
<div class="box box-primary">
    <div class="box-header with-border">
        <h3 class="box-title">科情服务任务单前台列表_${mes}</h3>
    </div>

    <div class="box-body">
        <!-- 数据表格 -->
        <div class="table-box">
            <!--工具栏-->
            <div class="pull-left">
                <div class="form-group form-inline">
                    <div class="btn-group">
                        <button type="button" class="btn btn-primary" data-toggle="modal" data-target="#addModal" title="新建" onclick="autoNumber()"><i class="fa fa-file-o"></i> 新建</button>
                        <button type="button" class="btn btn-default" onclick="window.location.reload();" title="刷新"><i class="fa fa-refresh"></i> 刷新</button>
                    </div>
                </div>
            </div>
            <%--新建模态框--%>
            <div class="modal fade" id="addModal" tabindex="-1" role="dialog" aria-labelledby="addModalLabel" aria-hidden="true">
                <div class="modal-dialog"  style="width: 800px;">
                    <div class="modal-content">
                        <div class="modal-header">
                            <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
                            <h4 class="modal-title" id="addModalLabel">新建科情服务任务单</h4>
                        </div>

                        <div class="modal-body">
                            <form id="kqfwForm" method="post">
                                <!-- 正文区域 -->
                                    <div class="row data-type">
                                        <div class="col-md-2 col-lg-2 col-xs-2 col-sm-2 title">编号</div>
                                        <div class="col-md-10 col-lg-10 col-xs-10 col-sm-10 data">
                                            <input type="text" id="number" class="form-control" name="number" placeholder="Auto" readonly="true">
                                        </div>
                                    </div>
                                    <div class="row data-type">
                                        <div class="col-md-2 col-lg-2 col-xs-2 col-sm-2 title">任务名称</div>
                                        <div class="form-group">
                                            <div class="col-md-10 col-lg-10 col-xs-10 col-sm-10 data">
                                                <input type="text" class="form-control" name="taskname">
                                            </div>
                                        </div>

                                    </div>

                                    <div class="row data-type">
                                        <div class="col-md-2 col-lg-2 col-xs-2 col-sm-2 title">单位</div>
                                        <div class="col-md-4 col-lg-4 col-xs-4 col-sm-4 data">
                                            <div class="form-group">
                                                <input type="text" class="form-control" name="organization">
                                            </div>
                                        </div>


                                        <div class="col-md-2 col-lg-2 col-xs-2 col-sm-2 title">联系人</div>
                                        <div class="col-md-4 col-lg-4 col-xs-4 col-sm-4 data">
                                            <div class="form-group">
                                                <input type="text" class="form-control" name="linkman">
                                            </div>
                                        </div>
                                    </div>


                                    <div class="row data-type">

                                        <div class="col-md-2 col-lg-2 col-xs-2 col-sm-2 title">联系电话</div>
                                        <div class="col-md-4 col-lg-4 col-xs-4 col-sm-4 data">
                                            <div class="form-group">
                                                <input type="text" class="form-control" name="telephone" placeholder="办公电话/手机">
                                            </div>
                                        </div>
                                        <div class="col-md-2 col-lg-2 col-xs-2 col-sm-2 title">下达时间</div>
                                        <div class="col-md-4 col-lg-4 col-xs-4 col-sm-4 data">
                                            <div class="form-group">
                                                <div class="input-group date">
                                                    <div class="input-group-addon">
                                                        <i class="fa fa-calendar"></i>
                                                    </div>
                                                    <input type="date" class="form-control pull-right" name="givetime">
                                                </div>
                                            </div>
                                        </div>
                                    </div>

                                    <div class="row data-type">
                                            <div class="col-md-2 col-lg-2 col-xs-2 col-sm-2 title">完成时限（/天）</div>

                                            <div class="col-md-4 col-lg-4 col-xs-4 col-sm-4 data">
                                                <div class="form-group">
                                                    <input type="text" class="form-control" name="timelimit" placeholder="不能小于5天">
                                                </div>
                                            </div>

                                            <div class="col-md-2 col-lg-2 col-xs-2 col-sm-2 title">任务类型</div>
                                            <div class="col-md-4 col-lg-4 col-xs-4 col-sm-4 data">
                                                <div class="form-group">
                                                    <select class="form-control select2" style="width: 100%"
                                                            name="tasktype">
                                                        <option value="0" selected="selected">资料收集</option>
                                                        <option value="1">科技查新</option>
                                                        <option value="2">前沿动态分析整编</option>
                                                        <option value="3">"信息专员"服务</option>
                                                        <option value="4">团队学术影响力分析</option>
                                                        <option value="5">其他</option>
                                                    </select>
                                                </div>
                                            </div>
                                        </div>


                                    <div class="row data-type">
                                        <div class="col-md-2 col-lg-2 col-xs-2 col-sm-2 title">中英文关键词</div>
                                        <div class="col-md-10 col-lg-10 col-xs-10 col-sm-10 data">
                                            <div class="form-group">
                                                <input type="text" class="form-control" name="keywords">
                                            </div>
                                        </div>
                                        </div>


                                    <div class="row data-type">
                                        <div class="col-md-2 col-lg-2 col-xs-2 col-sm-2 title rowHeight2x">任务背景</div>
                                        <div class="form-group">
                                        <div class="col-md-10 col-lg-10 col-xs-10 col-sm-10 data rowHeight2x">
                                            <textarea class="form-control" rows="2" name="taskbackground"></textarea>
                                        </div>
                                        </div>
                                    </div>

                                    <div class="row data-type">
                                        <div class="col-md-2 col-lg-2 col-xs-2 col-sm-2 title rowHeight2x">任务简述</div>
                                        <div class="form-group">
                                        <div class="col-md-10 col-lg-10 col-xs-10 col-sm-10 data rowHeight2x">
                                            <textarea class="form-control" rows="2" name="taskmark"></textarea>
                                        </div>
                                        </div>
                                    </div>

                                    <div class="row data-type">
                                        <div class="col-md-2 col-lg-2 col-xs-2 col-sm-2 title rowHeight2x">具体要求</div>
                                        <div class="form-group">
                                        <div class="col-md-10 col-lg-10 col-xs-10 col-sm-10 data rowHeight2x">
                                            <textarea class="form-control" rows="2" name="specification"></textarea>
                                        </div>
                                        </div>
                                    </div>

                                    <div class="row data-type">
                                        <div class="col-md-2 col-lg-2 col-xs-2 col-sm-2 title rowMinHeight8x">任务完成情况</div>
                                        <div class="col-md-10 col-lg-10 col-xs-10 col-sm-10 data rowMinHeight8x">
                                            <textarea class="form-control" rows="4" name="taskInfo" disabled="disabled"></textarea>
                                            <table class="table table-bordered table-striped table-hover dataTable">
                                                <thead>
                                                <tr>
                                                    <th class="text-center">完成人</th>
                                                    <th class="text-center">部职别</th>
                                                    <th class="text-center">任务分工</th>
                                                </tr>
                                                </thead>
                                                <tbody class="tb">
                                                <tr>
                                                    <td>
                                                        <input type="text" class="form-control" name="person_in_charge" disabled="disabled">
                                                    </td>
                                                    <td>
                                                        <input type="text" class="form-control" name="level" disabled="disabled">
                                                    </td>
                                                    <td>
                                                        <input type="text" class="form-control" name="task_allocation" disabled="disabled">
                                                    </td>
                                                </tr>
                                                <tr>
                                                    <td>
                                                        <input type="text" class="form-control" name="person_in_charge" disabled="disabled">
                                                    </td>
                                                    <td>
                                                        <input type="text" class="form-control" name="level" disabled="disabled">
                                                    </td>
                                                    <td>
                                                        <input type="text" class="form-control" name="task_allocation" disabled="disabled">
                                                    </td>
                                                </tr>
                                                <tr>
                                                    <td>
                                                        <input type="text" class="form-control" name="person_in_charge" disabled="disabled">
                                                    </td>
                                                    <td>
                                                        <input type="text" class="form-control" name="level" disabled="disabled">
                                                    </td>
                                                    <td>
                                                        <input type="text" class="form-control" name="task_allocation" disabled="disabled">
                                                    </td>
                                                </tr>
                                                </tbody>
                                            </table>
                                        </div>
                                    </div>

                                    <div class="row data-type">
                                        <div class="col-md-2 col-lg-2 col-xs-2 col-sm-2 title rowHeight2x">任务反馈</div>
                                        <div class="col-md-10 col-lg-10 col-xs-10 col-sm-10 data rowHeight2x">
                                            <textarea class="form-control" rows="3" name="taskfeedback" disabled="disabled"></textarea>
                                        </div>
                                    </div>
                                <!-- 正文区域 /-->
                            </form>
                        </div>
                        <div class="modal-footer">
                            <button type="button" class="btn btn-primary" id="submitTask">提交</button>
                            <button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
                        </div>
                    </div>
                </div>
            </div>
            <%--新建模态框结束--%>
            <div class="box-tools pull-right">
                <div class="has-feedback">
                    <form class="navbar-form navbar-left" role="search">
                        <div class="form-group">
                            <input type="serach" class="form-control" placeholder="Search" id="search-val">
                        </div>
                        <button type="submit" class="btn btn-info" id="btn-search">
                            <span class="glyphicon glyphicon-search"></span>
                        </button>
                    </form>
                </div>
            </div>
            <!--工具栏/-->
            <!--数据列表-->
            <table id="dataList" class="table table-bordered table-striped table-hover dataTable">
                <thead>
                <tr>
                    <th>序号</th>
                    <th class="sorting_asc sorting_asc_disabled">编号</th>
                    <th class="sorting_desc sorting_desc_disabled">任务名称</th>
                    <th class="text-center sorting">下达时间</th>
                    <th class="text-center">完成时限</th>
                    <th class="text-center">任务状态</th>
                    <th class="text-center">驳回原因</th>
                    <th class="text-center">操作</th>
                </tr>
                </thead>
                <tbody>
                <c:forEach items="${pageInfo.list}" var="task" varStatus="status">
                    <tr>
                        <td>${(pageInfo.pageNum-1)*pageInfo.pageSize+status.count}</td>
                        <td>${task.number}</td>
                        <td>${task.taskname}</td>
                        <td class="text-center">${task.givetimeStr}</td>
                        <td class="text-center">${task.timelimit}</td>
                        <c:if test="${task.status==1}">
                            <td class="text-center" style="color: #00a65a;font-weight: bold">已提交</td>
                        </c:if>
                        <c:if test="${task.status==2}">
                            <td class="text-center" style="color: red;font-weight: bold">待修改
                            </td>
                        </c:if>
                        <c:if test="${task.status==3}">
                            <td class="text-center" style="color: #1b6d85;font-weight: bold">任务进行中</td>
                        </c:if>
                        <c:if test="${task.status==4}">
                            <td class="text-center" style="color: #605ca8;font-weight: bold">资料查找完成</td>
                        </c:if>
                        <c:if test="${task.status==5}">
                            <td class="text-center" style="color: #605ca8;font-weight: bold">已完成</td>
                        </c:if>
                        <td class="text-center">${task.reject}</td>
                        <td class="text-center" style="min-width: 221px;">
                            <button type="button" class="btn bg-blue btn-xs" onclick="showCodeModal(${task.id},'S')">查看</button>
                            <c:if test="${task.status==1}">
                                <button type="button" class="btn bg-olive btn-xs" onclick="showCodeModal(${task.id},'E')" title="请等待管理员审核！当前状态不可编辑！" disabled="disabled">编辑</button>
                            </c:if>
                            <c:if test="${task.status==3}">
                                <button type="button" class="btn bg-olive btn-xs" onclick="showCodeModal(${task.id},'E')" title="审核通过！资料查找中不需要编辑" disabled="disabled">编辑</button>
                            </c:if>
                            <c:if test="${task.status==4}">
                                <button type="button" class="btn bg-olive btn-xs" onclick="showCodeModal(${task.id},'E')" title="资料查找完成！无需编辑！" disabled="disabled">编辑</button>
                            </c:if>
                            <c:if test="${task.status==5}">
                                <button type="button" class="btn bg-olive btn-xs" onclick="showCodeModal(${task.id},'E')" title="此任务已完成！无需编辑！" disabled="disabled">编辑</button>
                            </c:if>
                            <c:if test="${task.status==2}">
                                <button type="button" class="btn bg-olive btn-xs" onclick="showCodeModal(${task.id},'E')">编辑</button>
                            </c:if>
                            <c:if test="${task.status==1}">
                                <button type="button" target="_blank" class="btn bg-purple btn-xs" onclick="showCodeModal(${task.id},'D')" title="等待管理员审核！暂无反馈资料！" download="${task.taskname}" disabled="disabled">暂无反馈资料</button>
                            </c:if>
                            <c:if test="${task.status==2}">
                                <button type="button" class="btn bg-purple btn-xs" onclick="showCodeModal(${task.id},'D')" title="等待用户修改中！暂无反馈资料！" download="${task.taskname}" disabled="disabled">暂无反馈资料</button>
                            </c:if>
                            <c:if test="${task.status==3}">
                                <button type="button" class="btn bg-purple btn-xs" onclick="showCodeModal(${task.id},'D')" title="资料查找中！请期待！" download="${task.taskname}" disabled="disabled">暂无反馈资料</button>
                            </c:if>
                            <c:if test="${task.status==4}">
                                <button type="button" class="btn bg-purple btn-xs" onclick="showCodeModal(${task.id},'D')" title="资料查找完成！请下载反馈资料！" download="${task.taskname}">下载反馈资料</button>
                            </c:if>
                            <c:if test="${task.status==5}">
                                <button type="button" class="btn bg-purple btn-xs" onclick="showCodeModal(${task.id},'D')" title="任务已完成！您可以下载反馈资料！" download="${task.taskname}">下载反馈资料</button>
                            </c:if>

                            <c:if test="${task.status==1}">
                                <button type="button" class="btn bg-blue btn-xs" onclick="showCodeModal(${task.id},'F')" title="等待管理员审核！暂不需要反馈" disabled="disabled">任务反馈</button>
                            </c:if>
                            <c:if test="${task.status==2}">
                                <button type="button" class="btn bg-blue btn-xs" onclick="showCodeModal(${task.id},'F')" title="等待用户修改中！此状态不可反馈" disabled="disabled">任务反馈</button>
                            </c:if>
                            <c:if test="${task.status==3}">
                                <button type="button" class="btn bg-blue btn-xs" onclick="showCodeModal(${task.id},'F')" title="资料查找中！请等待资料查找完成后进行反馈" disabled="disabled">任务反馈</button>
                            </c:if>
                            <c:if test="${task.status==4}">
                                <button type="button" class="btn bg-blue btn-xs" onclick="showCodeModal(${task.id},'F')" title="资料已经查找完成！您可以填写任务反馈！">任务反馈</button>
                            </c:if>
                            <c:if test="${task.status==5}">
                                <button type="button" class="btn bg-blue btn-xs" onclick="showCodeModal(${task.id},'F')" title="任务已完成！无需操作！" disabled="disabled">任务反馈</button>
                            </c:if>
                        </td>
                    </tr>
                </c:forEach>
                </tbody>
            </table>
            <!--数据列表/-->
        </div>
        <!-- 数据表格 /-->
    </div>
    <!-- /.box-body -->
    <!-- .box-footer-->
    <div class="box-footer">
        <div class="pull-left">
            <div class="form-group form-inline">
                总共${pageInfo.pages}页，共${pageInfo.total} 条数据。 每页
                <select class="form-control" id="changePageSize" onchange="changePageSize()">
                    <option>&nbsp;5 </option>
                    <option>10</option>
                    <option>15</option>
                    <option>20</option>
                    <option>30</option>
                </select> 条
            </div>
        </div>
        <div class="box-tools pull-right">
            <ul class="pagination">
                <li>
                    <a href="${pageContext.request.contextPath}/kqfw/findTaskUI.do?page=1&pageSize=${pageInfo.pageSize}" aria-label="Previous">首页</a>
                </li>
                <li><a href="${pageContext.request.contextPath}/kqfw/findTaskUI.do?page=${pageInfo.pageNum-1}&pageSize=${pageInfo.pageSize}">上一页</a></li>
                <c:forEach begin="1" end="${pageInfo.pages}" var="pageNum">
                    <li><a href="${pageContext.request.contextPath}/kqfw/findTaskUI.do?page=${pageNum}&pageSize=${pageInfo.pageSize}">${pageNum}</a></li>
                </c:forEach>
                <li><a href="${pageContext.request.contextPath}/kqfw/findTaskUI.do?page=${pageInfo.pageNum+1}&pageSize=${pageInfo.pageSize}">下一页</a></li>
                <li>
                    <a href="${pageContext.request.contextPath}/kqfw/findTaskUI.do?page=${pageInfo.pages}&pageSize=${pageInfo.pageSize}" aria-label="Next">尾页</a>
                </li>
            </ul>
        </div>
    </div>
    <!-- /.box-footer-->

    <%--修改模态框--%>
    <div class="modal fade" id="updateModal" tabindex="-1" role="dialog" aria-labelledby="updateModalLabel" aria-hidden="true">
        <div class="modal-dialog" style="width: 800px;">
            <div class="modal-content">
                <div class="modal-header">
                    <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
                    <h4 class="modal-title" id="updateModalLabel">修改科情服务任务单</h4>
                </div>
                <div class="modal-body">
                    <form id="updatekqfwForm" method="post">
                        <!-- 正文区域 -->
                        <div class="row data-type">
                            <div class="col-md-2 col-lg-2 col-xs-2 col-sm-2 title">ID</div>
                            <div class="col-md-10 col-lg-10 col-xs-10 col-sm-10 data">
                                <input type="text" class="form-control" id="edit_id" name="id" readonly="true">
                            </div>
                        </div>
                        <div class="row data-type">
                            <div class="col-md-2 col-lg-2 col-xs-2 col-sm-2 title">编号</div>
                            <div class="col-md-10 col-lg-10 col-xs-10 col-sm-10 data">
                                <input type="text" class="form-control" id="edit_number" name="number" readonly="true">
                            </div>
                        </div>
                        <div class="row data-type">
                            <div class="col-md-2 col-lg-2 col-xs-2 col-sm-2 title">任务名称</div>
                            <div class="form-group">
                                <div class="col-md-10 col-lg-10 col-xs-10 col-sm-10 data">
                                    <input type="text" class="form-control" name="taskname" id="edit_taskname">
                                </div>
                            </div>
                        </div>
                        <div class="row data-type">
                            <div class="col-md-2 col-lg-2 col-xs-2 col-sm-2 title">单位</div>
                            <div class="col-md-4 col-lg-4 col-xs-4 col-sm-4 data">
                                <input type="text" class="form-control" name="organization" id="edit_organization">
                            </div>
                            <div class="col-md-2 col-lg-2 col-xs-2 col-sm-2 title">联系人</div>
                            <div class="col-md-4 col-lg-4 col-xs-4 col-sm-4 data">
                                <input type="text" class="form-control" name="linkman" id="edit_linkman">
                            </div>
                        </div>
                        <div class="row data-type">
                            <div class="col-md-2 col-lg-2 col-xs-2 col-sm-2 title">联系电话</div>
                            <div class="col-md-4 col-lg-4 col-xs-4 col-sm-4 data">
                                <input type="text" class="form-control" name="telephone" placeholder="办公电话/手机" id="edit_telephone">
                            </div>
                            <div class="col-md-2 col-lg-2 col-xs-2 col-sm-2 title">下达时间</div>
                            <div class="col-md-4 col-lg-4 col-xs-4 col-sm-4 data">
                                <div class="input-group date">
                                    <div class="input-group-addon">
                                        <i class="fa fa-calendar"></i>
                                    </div>
                                    <input type="text" class="form-control pull-right" name="givetime" id="edit_givetime" readonly="readonly">
                                </div>
                            </div>
                        </div>

                        <div class="row data-type">
                            <div class="col-md-2 col-lg-2 col-xs-2 col-sm-2 title">完成时限（/天）</div>
                            <div class="col-md-4 col-lg-4 col-xs-4 col-sm-4 data">
                                <input type="text" class="form-control" name="timelimit" id="edit_timelimit" placeholder="不能小于5天">
                            </div>
                            <div class="col-md-2 col-lg-2 col-xs-2 col-sm-2 title">任务类型</div>
                            <div class="col-md-4 col-lg-4 col-xs-4 col-sm-4 data">
                                <select class="form-control select2" style="width: 100%"
                                        name="tasktype" id="edit_tasktype">
                                    <option value="0" selected="selected">资料收集</option>
                                    <option value="1">科技查新</option>
                                    <option value="2">前沿动态分析整编</option>
                                    <option value="3">"信息专员"服务</option>
                                    <option value="4">团队学术影响力分析</option>
                                    <option value="5">其他</option>
                                </select>
                            </div>
                        </div>

                        <div class="row data-type">
                            <div class="col-md-2 col-lg-2 col-xs-2 col-sm-2 title">中英文关键词</div>
                            <div class="col-md-10 col-lg-10 col-xs-10 col-sm-10 data">
                                <input type="text" class="form-control" name="keywords" id="edit_keywords">
                            </div>
                        </div>

                        <div class="row data-type">
                            <div class="col-md-2 col-lg-2 col-xs-2 col-sm-2 title rowHeight2x">任务背景</div>
                            <div class="col-md-10 col-lg-10 col-xs-10 col-sm-10 data rowHeight2x">
                                <textarea class="form-control" rows="3" name="taskbackground" id="edit_taskbackground"></textarea>
                            </div>
                        </div>

                        <div class="row data-type">
                            <div class="col-md-2 col-lg-2 col-xs-2 col-sm-2 title rowHeight2x">任务简述</div>
                            <div class="col-md-10 col-lg-10 col-xs-10 col-sm-10 data rowHeight2x">
                                <textarea class="form-control" rows="3" name="taskmark" id="edit_taskmark"></textarea>
                            </div>
                        </div>

                        <div class="row data-type">
                            <div class="col-md-2 col-lg-2 col-xs-2 col-sm-2 title rowHeight2x">具体要求</div>
                            <div class="col-md-10 col-lg-10 col-xs-10 col-sm-10 data rowHeight2x">
                                <textarea class="form-control" rows="3" name="specification" id="edit_specification"></textarea>
                            </div>
                        </div>

                        <div class="row data-type">
                            <div class="col-md-2 col-lg-2 col-xs-2 col-sm-2 title rowMinHeight8x">任务完成情况</div>
                            <div class="col-md-10 col-lg-10 col-xs-10 col-sm-10 data rowMinHeight8x">
                                <textarea class="form-control" rows="4" name="taskInfo" id="edit_taskInfo" readonly="readonly"></textarea>
                                <table class="table table-bordered table-striped table-hover dataTable">
                                    <thead>
                                    <tr>
                                        <th class="text-center">完成人</th>
                                        <th class="text-center">部职别</th>
                                        <th class="text-center">任务分工</th>
                                    </tr>
                                    </thead>
                                    <tbody class="tb" id="uptbody">
                                    <script type="text/html" id="templateList">
                                        {{each kqfwPerformance as value index}}
                                        <tr>
                                            <td style="display: none">
                                                <input type="text" class="form-control" name="pid" value="{{value.id}}" readonly="readonly">
                                            </td>
                                            <td>
                                                <input type="text" class="form-control" name="person_in_charge" value="{{value.person_in_charge}}" id="edit_person_in_charge" readonly="readonly">
                                            </td>
                                            <td>
                                                <input type="text" class="form-control" name="level" value="{{value.level}}" id="edit_level" readonly="readonly">
                                            </td>
                                            <td>
                                                <input type="text" class="form-control" name="task_allocation" value="{{value.task_allocation}}" id="edit_task_allocation" readonly="readonly">
                                            </td>
                                        </tr>
                                        {{/each}}
                                    </script>
                                    </tbody>
                                </table>
                            </div>
                        </div>

                        <div class="row data-type">
                            <div class="col-md-2 col-lg-2 col-xs-2 col-sm-2 title rowHeight2x">任务反馈</div>
                            <div class="col-md-10 col-lg-10 col-xs-10 col-sm-10 data rowHeight2x">
                                <textarea class="form-control" rows="3" name="taskfeedback" id="edit_taskfeedback" disabled="disabled"></textarea>
                            </div>
                        </div>
                        <!-- 正文区域 /-->
                    </form>
                </div>
                <div class="modal-footer">
                    <button type="button" class="btn btn-primary" id="updateTask">修改</button>
                    <button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
                </div>
            </div>
        </div>
    </div>
    <%--修改模态框结束--%>
    <%--查看详情模态框--%>
    <div class="modal fade" id="detailModal" tabindex="-1" role="dialog" aria-labelledby="detailModalLabel" aria-hidden="true">
        <div class="modal-dialog"  style="width: 800px;">
            <div class="modal-content">
                <div class="modal-header">
                    <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
                    <h4 class="modal-title" id="detailModalLabel">科情服务任务单详情</h4>
                </div>

                <div class="modal-body">
                    <form id="detailkqfwForm" method="post">
                        <!-- 正文区域 -->
                        <div class="row data-type">
                            <div class="col-md-2 col-lg-2 col-xs-2 col-sm-2 title">编号</div>
                            <div class="col-md-10 col-lg-10 col-xs-10 col-sm-10 data">
                                <input type="text" class="form-control" id="detail_number" name="number" readonly="readonly">
                            </div>
                        </div>
                        <div class="row data-type">
                            <div class="col-md-2 col-lg-2 col-xs-2 col-sm-2 title">任务名称</div>
                            <div class="form-group">
                                <div class="col-md-10 col-lg-10 col-xs-10 col-sm-10 data">
                                    <input type="text" class="form-control" name="taskname" id="detail_taskname" readonly="readonly">
                                </div>
                            </div>

                        </div>
                        <div class="row data-type">
                            <div class="col-md-2 col-lg-2 col-xs-2 col-sm-2 title">单位</div>
                            <div class="col-md-4 col-lg-4 col-xs-4 col-sm-4 data">
                                <input type="text" class="form-control" name="organization" id="detail_organization" readonly="readonly">
                            </div>
                            <div class="col-md-2 col-lg-2 col-xs-2 col-sm-2 title">联系人</div>
                            <div class="col-md-4 col-lg-4 col-xs-4 col-sm-4 data">
                                <input type="text" class="form-control" name="linkman" id="detail_linkman" readonly="readonly">
                            </div>
                        </div>
                        <div class="row data-type">
                            <div class="col-md-2 col-lg-2 col-xs-2 col-sm-2 title">联系电话</div>
                            <div class="col-md-4 col-lg-4 col-xs-4 col-sm-4 data">
                                <input type="text" class="form-control" name="telephone" placeholder="办公电话/手机" id="detail_telephone" readonly="readonly">
                            </div>
                            <div class="col-md-2 col-lg-2 col-xs-2 col-sm-2 title">下达时间</div>
                            <div class="col-md-4 col-lg-4 col-xs-4 col-sm-4 data">
                                <div class="input-group date">
                                    <div class="input-group-addon">
                                        <i class="fa fa-calendar"></i>
                                    </div>
                                    <input type="text" class="form-control pull-right" name="givetime" id="detail_givetime" readonly="readonly">
                                </div>
                            </div>
                        </div>

                        <div class="row data-type">
                            <div class="col-md-2 col-lg-2 col-xs-2 col-sm-2 title">完成时限（/天）</div>
                            <div class="col-md-4 col-lg-4 col-xs-4 col-sm-4 data">
                                <input type="text" class="form-control" name="timelimit" id="detail_timelimit" placeholder="不能小于5天" readonly="readonly">
                            </div>
                            <div class="col-md-2 col-lg-2 col-xs-2 col-sm-2 title">任务类型</div>
                            <div class="col-md-4 col-lg-4 col-xs-4 col-sm-4 data">
                                <select class="form-control select2" style="width: 100%"
                                        name="tasktype" id="detail_tasktype" readonly="readonly">
                                    <option value="0" selected="selected">资料收集</option>
                                    <option value="1">科技查新</option>
                                    <option value="2">前沿动态分析整编</option>
                                    <option value="3">"信息专员"服务</option>
                                    <option value="4">团队学术影响力分析</option>
                                    <option value="5">其他</option>
                                </select>
                            </div>
                        </div>

                        <div class="row data-type">
                            <div class="col-md-2 col-lg-2 col-xs-2 col-sm-2 title">中英文关键词</div>
                            <div class="col-md-10 col-lg-10 col-xs-10 col-sm-10 data" readonly="readonly">
                                <input type="text" class="form-control" name="keywords" id="detail_keywords">
                            </div>
                        </div>

                        <div class="row data-type">
                            <div class="col-md-2 col-lg-2 col-xs-2 col-sm-2 title rowHeight2x">任务背景</div>
                            <div class="col-md-10 col-lg-10 col-xs-10 col-sm-10 data rowHeight2x">
                                <textarea class="form-control" rows="2" name="taskbackground" id="detail_taskbackground" readonly="readonly"></textarea>
                            </div>
                        </div>

                        <div class="row data-type">
                            <div class="col-md-2 col-lg-2 col-xs-2 col-sm-2 title rowHeight2x">任务简述</div>
                            <div class="col-md-10 col-lg-10 col-xs-10 col-sm-10 data rowHeight2x">
                                <textarea class="form-control" rows="2" name="taskmark" id="detail_taskmark" readonly="readonly"></textarea>
                            </div>
                        </div>

                        <div class="row data-type">
                            <div class="col-md-2 col-lg-2 col-xs-2 col-sm-2 title rowHeight2x">具体要求</div>
                            <div class="col-md-10 col-lg-10 col-xs-10 col-sm-10 data rowHeight2x">
                                <textarea class="form-control" rows="2" name="specification" id="detail_specification" readonly="readonly"></textarea>
                            </div>
                        </div>

                        <div class="row data-type">
                            <div class="col-md-2 col-lg-2 col-xs-2 col-sm-2 title rowMinHeight9x">任务完成情况</div>
                            <div class="col-md-10 col-lg-10 col-xs-10 col-sm-10 data rowMinHeight9x">
                                <textarea class="form-control" rows="2" name="taskInfo" id="detail_taskInfo" readonly="readonly"></textarea>
                                <table class="table table-bordered table-striped table-hover dataTable">
                                    <thead>
                                    <tr>
                                        <th class="text-center">完成人</th>
                                        <th class="text-center">部职别</th>
                                        <th class="text-center">任务分工</th>
                                    </tr>
                                    </thead>
                                    <tbody class="tb" id="detail-tbody">
                                    <script type="text/html" id="detialTemplateList">
                                        {{each kqfwPerformance as value index}}
                                        <tr>
                                            <td>
                                                <input type="text" class="form-control" name="person_in_charge" value="{{value.person_in_charge}}" id="detail_person_in_charge" readonly="readonly">
                                            </td>
                                            <td>
                                                <input type="text" class="form-control" name="level" value="{{value.level}}" id="detail_level" readonly="readonly">
                                            </td>
                                            <td>
                                                <input type="text" class="form-control" name="task_allocation" value="{{value.task_allocation}}" id="detail_task_allocation" readonly="readonly">
                                            </td>
                                        </tr>
                                        {{/each}}
                                    </script>
                                    </tbody>
                                </table>
                            </div>
                        </div>

                        <div class="row data-type">
                            <div class="col-md-2 col-lg-2 col-xs-2 col-sm-2 title rowHeight2x">任务反馈</div>
                            <div class="col-md-10 col-lg-10 col-xs-10 col-sm-10 data rowHeight2x">
                                <textarea class="form-control" rows="3" name="taskfeedback" id="detail_taskfeedback" disabled="disabled"></textarea>
                            </div>
                        </div>
                        <!-- 正文区域 /-->
                    </form>
                </div>
                <div class="modal-footer">
                    <button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
                </div>
            </div>
        </div>
    </div>
    <%--查看详情模态框--%>
    <%--请求成功后弹出模态框--%>
    <div class="modal fade" id="infoModal" tabindex="-1" role="dialog" aria-labelledby="infoModalLabel" aria-hidden="true">
        <div class="modal-dialog">
            <div class="modal-content">
                <div class="modal-header">
                    <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
                    <h4 class="modal-title" id="infoModalLabel">提示信息</h4>
                </div>

                <div class="modal-body">
                    <div style="text-align:center;">
                        <h3 style="color: #5eb454">科情服务任务单提交成功</h3>
                        <img src="${pageContext.request.contextPath}/img/duihao.png"/>
                        <div>本次随机码：<label style="height: 35px;width: 60px;font-size: 20px;color: #bf800c;" id="RamCode"></label></div>
                        <label>为方便后续的查询、以及资料下载，请妥善保存此随机码！</label>
                    </div>
                </div>
                <div class="modal-footer">
                    <button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
                </div>
            </div>
        </div>
    </div>
    <%--请求成功后弹出模态框结束--%>
    <%--验证随机码模态框--%>
                <div style="height: 150px;width: 280px;border:1px solid #b5bbc8;border-radius:5px;padding:5px;display: none;position: fixed;z-index: 999;background-color:rgb(213, 213, 213);top: 20%;left: 0;right: 0;margin:0 auto;" id="checkbox">
                    <div style="text-align:center;margin-bottom: 20px;">
                        <h4 style="color: #5eb454;margin-bottom: 15px;">请输入随机码进行验证</h4>
                        <form id="checkCodeForm" method="post">
                            <input type="text"  name="id" id="checkCodeId" readonly="readonly" style="display: none">
                            <input type="text"  name="code" id="code" style="height: 42px;border-radius: 5px;">
                            <input type="text" name="reqtype" id="reqType" readonly="readonly" style="display: none">
                        </form>
                    </div>
                    <div class="box-tools pull-right">
                        <button type="button" class="btn btn-primary" onclick="checkCode()">确认</button>
                        <button type="button" class="btn btn-default" onclick="closeCodeBox()">关闭</button>
                    </div>
                </div>

    <%--请求成功后弹出模态框失败--%>
    <%--反馈模态框--%>
    <div class="modal fade" id="feedbackModal" tabindex="-1" role="dialog" aria-labelledby="feedbackModalLabel" aria-hidden="true">
        <div class="modal-dialog" style="width: 800px;">
            <div class="modal-content">
                <div class="modal-header">
                    <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
                    <h4 class="modal-title" id="feedbackModalLabel">填写反馈意见</h4>
                </div>

                <div class="modal-body">
                    <form id="feedbackkqfwForm" method="post">
                        <input type="text" name="id" id="feedbackId" readonly="readonly" style="display: none">
                        <!-- 正文区域 -->
                        <div class="row data-type">
                            <div class="col-md-2 col-lg-2 col-xs-2 col-sm-2 title rowHeight2x">任务反馈</div>
                            <div class="col-md-10 col-lg-10 col-xs-10 col-sm-10 data rowHeight2x">
                                <textarea class="form-control" rows="3" name="taskfeedback" id="taskfeedback"></textarea>
                            </div>
                        </div>
                        <!-- 正文区域 /-->
                    </form>
                </div>
                <div class="modal-footer">
                    <button type="button" class="btn btn-primary" id="subfeedback">提交反馈</button>
                    <button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
                </div>
            </div>
        </div>
    </div>
    <%--反馈模态框结束--%>
</div>
<script>
    $(function (){
        // 按回车健获取文本框的值并检索数据
        $('#search-val').on('keydown',function(e){
            if (e.keyCode == 13) {
                var param=$(this).val();
                console.log(param);
                search(1,10,param);
            }

        });
        $('#btn-search').click(function(){
            var param=$('#search-val').val();
            console.log(param);
            search(1,10,param);
            return false;
        });
        //新增任务单
        $('#submitTask').click(function(event) {
            /* Act on the event */
            /*手动验证表单，当是普通按钮时。*/
            $('#kqfwForm').data('bootstrapValidator').validate();//启用验证
            var flag = $('#kqfwForm').data('bootstrapValidator').isValid()//验证是否通过true/false
            if(flag){
                //获取表单数据
                var data=$("#kqfwForm").serializeArray();
                $.post("${pageContext.request.contextPath}/api/createTask",data,function (result){
                    console.log(result);
                    if (result.status=="success"){
                        showQuery(result);

                    }else {
                        alert("创建任务单失败！");
                        window.location.reload();
                    }
                })
            }
        });
        //修改
        $('#updateTask').click(function(event) {
            //获取表单数据
            var data=$("#updatekqfwForm").serializeArray();
            $.post("${pageContext.request.contextPath}/api/updateTask",data,function (result){
                console.log(result);
                if (result=="OK"){
                    alert("修改任务单成功！");
                    window.location.reload();
                }else {
                    alert("修改任务单失败！");
                    window.location.reload();
                }
            })
        });
        //提交反馈
        $('#subfeedback').click(function (event) {
            //获取表单数据
            var data=$("#feedbackkqfwForm").serializeArray();
            $.post("${pageContext.request.contextPath}/api/updatefeedback",data,function (result){
                console.log(result);
                if (result=="OK"){
                    alert("提交反馈成功！");
                    window.location.reload();
                }else {
                    alert("提交反馈失败！");
                    window.location.reload();
                }
            })
        });
        //当出发模态框关闭事件时
        $('#infoModal').on('hide.bs.modal', function () {
            window.location.reload();
        })

    });
    function search(page,pageSize,tl){
        window.open("${pageContext.request.contextPath}/kqfw/findTaskByNameUI.do?page="+page+"&pageSize="+pageSize+"&tl="+tl)
    }
    function showQuery(data){
        $("#RamCode").text(data.code);
        //显示模态框
        $('#infoModal').modal('show');

    }
    function changePageSize() {
        //获取下拉框的值
        var pageSize = $("#changePageSize").val();
        //向服务器发送请求，改变没页显示条数
        location.href = "${pageContext.request.contextPath}/kqfw/findTaskUI.do?page=1&pageSize="
            + pageSize;
    }
    //获取自动递增的编号
    function autoNumber(){
        $.get("${pageContext.request.contextPath}/api/getNumber",function (obj){
            var number=obj.number;
            $("#number").val(number);
        },"json")
    }
    //修改任务单之前先查看
    function editTask(data){
               closeCodeBox();
               $("#edit_id").val(data.id);
               $("#edit_number").val(data.number);
               $("#edit_taskname").val(data.taskname);
               $("#edit_organization").val(data.organization);
               $("#edit_linkman").val(data.linkman);
               $("#edit_telephone").val(data.telephone);
               $("#edit_givetime").val(data.givetimeStr);
               $("#edit_timelimit").val(data.timelimit);
               $("#edit_tasktype").val(data.tasktype);
               $("#edit_keywords").val(data.keywords);
               $("#edit_taskbackground").val(data.taskbackground);
               $("#edit_taskmark").val(data.taskmark);
               $("#edit_specification").val(data.specification);
               $("#edit_task_allocation").val(data.task_allocation);
               $("#edit_taskfeedback").val(data.taskfeedback);
               $("#edit_taskInfo").val(data.taskInfo);
               var html=template('templateList',data);
               $('#uptbody').html(html);
                //显示模态框
               $('#updateModal').modal('show');
    }
    //查看任务单详情
    function detailTask(data){
            closeCodeBox();
            $("#detail_number").val(data.number);
            $("#detail_taskname").val(data.taskname);
            $("#detail_organization").val(data.organization);
            $("#detail_linkman").val(data.linkman);
            $("#detail_telephone").val(data.telephone);
            $("#detail_givetime").val(data.givetimeStr);
            $("#detail_timelimit").val(data.timelimit);
            $("#detail_tasktype").val(data.tasktype);
            $("#detail_keywords").val(data.keywords);
            $("#detail_taskbackground").val(data.taskbackground);
            $("#detail_taskmark").val(data.taskmark);
            $("#detail_specification").val(data.specification);
            $("#detail_task_allocation").val(data.task_allocation);
            $("#detail_taskfeedback").val(data.taskfeedback);
            $("#detail_taskInfo").val(data.taskInfo);
            var html2=template('detialTemplateList',data);
            $('#detail-tbody').html(html2);
            //显示模态框
            $('#detailModal').modal('show');
    }
    //任务反馈
    function feedback(data){
        closeCodeBox();
        $("#feedbackId").val(data.id);
        $('#feedbackModal').modal('show');
    }
    function showCodeModal(id,reqtype){
        $('#code').val("");
        //显示模态框
        $('#checkbox').show();
        $('#checkCodeId').val(id);
        $('#reqType').val(reqtype);
    }
    function closeCodeBox(){
        $('#checkbox').hide();
    }
    //验证随机码
    function checkCode(){
        //获取表单数据
        var data=$("#checkCodeForm").serializeArray();
        $.post("${pageContext.request.contextPath}/api/checkCode",data,function (result){
            console.log(result);
            if (result.checkResult==true){
                var operate_id=result.data.id;
                if (result.reqtype=="S"){
                    detailTask(result.data);
                }if (result.reqtype=="E"){
                    editTask(result.data);
                }if (result.reqtype=="D"){
                    download_Means(operate_id);
                }if (result.reqtype=="F"){
                    feedback(result.data);
                }

            }else {
                alert("随机码验证失败！请重新核对！");
                window.location.reload();
            }
        })


    }
    //删除任务单
    function deleteTask(id){
        $.get("${pageContext.request.contextPath}/api/deleteTask",{"id":id},function (data){
            if (data=="success"){
                alert("任务单删除成功！");
                window.location.reload();
            }else{
                alert("任务单删除失败！");
                window.location.reload();
            }

        },"json")
    }
    //设置新增列表选项
    function addTR(obj){
        var objTR = $(".tb");
        objTR.append("<tr><td><input type='text' class='form-control' name='person_in_charge'></td><td><input type='text' class='form-control' name='level'></td><td><input type='text' class='form-control' name='task_allocation'></td><td class='text-center'><a class='btn-default' onclick='deleteTR(this)'><i class='fa fa-trash fa-2x' aria-hidden='true'></i> </a></td></tr>")
    }
    //删除列表项目
    function deleteTR(ts){
       $(ts).parent().parent().remove();
    }
    function download_Means(id){
        $.ajax({
            type:"post",
            url:"${pageContext.request.contextPath}/api/downloadMeansById",
            data:{"id":id},
            success:function (data){
                if (data.message=="success"){
                    var durl=data.data;
                    window.open("${pageContext.request.contextPath}/"+durl);
                }else {
                    alert("下载失败！暂时未有反馈资料！")
                }
            }
        });
    }
    //表单验证
    $('#kqfwForm').bootstrapValidator({
        message: 'This value is not valid',
        feedbackIcons: {
            valid: 'glyphicon glyphicon-ok',
            invalid: 'glyphicon glyphicon-remove',
            validating: 'glyphicon glyphicon-refresh'
        },
        fields: {
            taskname: {
                message: '任务名称验证失败',
                validators: {
                    notEmpty: {
                        message: '任务名称不能为空'
                    },
                }
            },
            organization:{
                message:'单位验证失败',
                validators:{
                    notEmpty:{
                        message:'单位不能为空'
                    }
                }
            },
            linkman:{
                message:'联系人验证失败',
                validators:{
                    notEmpty:{
                        message:'联系人不能为空'
                    }
                }
            },
            telephone:{
                message:'联系电话验证失败',
                validators:{
                    notEmpty:{
                        message:'联系电话不能为空'
                    },
                    stringLength:{
                        max:11,
                        message:'联系电话最少6位，最长11位'
                    }
                }
            },
            timelimit: {
                message: '完成时限验证失败',
                validators: {
                    notEmpty: {
                        message: '完成时限不能为空'
                    },
                    digits:{
                        message:'该值单位为天，只填数字即可'
                    },
                    greaterThan:{
                        value : 5,
                        message:'完成时限不能小于五天'
                    }
                }
            },
            givetime: {
                message: '下达时间验证失败',
                validators: {
                    notEmpty: {
                        message: '下达时间不能为空'
                    },
                    regexp:{
                        regexp:/[0-9]{4}-[0-9]{2}-[0-9]{2}/,
                        message:'请填入xxxx-xx-xx（如2021-01-01）的日期格式'
                    }
                }
            },
            tasktype:{
                message: '任务类型验证失败',
                validators: {
                    notEmpty: {
                        message: '任务类型不能为空'
                    }
                }
            },
            keywords:{
                message: '中英文关键词验证失败',
                validators: {
                    notEmpty: {
                        message: '中英文关键词不能为空'
                    }
                }
            },
            taskbackground:{
                message: '任务背景验证失败',
                validators: {
                    notEmpty: {
                        message: '任务背景不能为空'
                    }
                }
            },
            taskmark:{
                message: '任务简述验证失败',
                validators: {
                    notEmpty: {
                        message: '任务简述不能为空'
                    }
                }
            },
            specification:{
                message: '具体要求失败',
                validators: {
                    notEmpty: {
                        message: '具体要求不能为空'
                    }
                }
            }

        }
    });
</script>
</body>

</html>